Skip to content

Conversation

@ekvanox
Copy link
Member

@ekvanox ekvanox commented Oct 6, 2025

Adds the ability to scan tickets via qr codes, and validating them server side.

Users get a qr code:
URL: /shop/inventory/{ticket_id}

image

Admin can consume the ticket:
URL: /events/{event_slug}/scan/{ticket_id}
image

New QR Code option under the admin tab:
image

Closes #716

Implements a complete QR code scanning system for validating and consuming event tickets:

Features:
- QR code scanner component using @zxing/library
- Event-specific scan pages at /events/[slug]/scan
- Consumable detail view with validation status
- Admin QR code management page at /admin/qr
- Ticket consumption tracking and history
- Support for scanning from inventory page

Changes:
- Add QRCodeScanner.svelte component with camera access
- Add useQRScanner hook for QR code detection
- Add consumable.ts server utilities for ticket consumption
- Add scan routes for events with ticket validation
- Add consume action to mark tickets as used
- Add QR code admin page to routes
- Filter events with tickets in event listing
- Update translations for scanning UI
- Add @zxing/library dependency

The system validates tickets against the event, checks consumption status,
displays owner information, and shows question responses if available.
@ekvanox ekvanox requested review from a team and Copilot October 6, 2025 18:34
@ekvanox ekvanox self-assigned this Oct 6, 2025
@ekvanox ekvanox requested review from ManneG and removed request for a team October 6, 2025 18:34
@ekvanox ekvanox added the enhancement New feature or request label Oct 6, 2025
@ekvanox ekvanox added this to CPU Oct 6, 2025
@github-project-automation github-project-automation bot moved this to 🆕 New in CPU Oct 6, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a comprehensive QR code ticket scanning system for events, allowing administrators to validate and consume tickets via QR codes. Users can generate QR codes for their tickets, and administrators can scan these codes to validate and consume tickets for specific events.

Key changes include:

  • Server-side ticket consumption logic with validation
  • QR code scanning interface for event administrators
  • Client-side QR scanner component using ZXing library
  • Comprehensive ticket validation UI showing status, owner, and event details

Reviewed Changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/translations/sv.json, src/translations/en.json Added translation strings for QR scanning functionality
src/routes/routes.ts Added QR Code admin route with webshop management access
src/routes/(app)/shop/tickets/[slug]/manage/+page.svelte Added TODO comment for dynamic text
src/routes/(app)/shop/tickets/[slug]/manage/+page.server.ts Refactored consume action to use shared consumable service
src/routes/(app)/shop/inventory/[id]/consume/+page.* Added direct ticket consumption endpoint
src/routes/(app)/events/[slug]/scan/[consumable]/+page.* Added detailed ticket validation and consumption interface
src/routes/(app)/events/[slug]/scan/+page.* Added QR scanner page for events
src/routes/(app)/events/[slug]/+page.* Added QR scanner button for authorized users
src/routes/(app)/admin/qr/+page.* Added admin QR scanner event selection interface
src/lib/server/shop/consumable.ts Created shared ticket consumption service
src/lib/hooks/useQRScanner.ts Added QR scanner hook using ZXing library
src/lib/components/shop/inventory/InventoryItemPage.svelte Fixed QR code data to use consumable ID
src/lib/components/QRCodeScanner.svelte Added QR scanner component
package.json Added ZXing library dependency
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

<h1 class="text-2xl">{ticket.title}</h1>

<a href="edit" class="btn btn-secondary">Redigera biljett</a>
<!-- TODO: Add dynamic text -->
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This TODO comment lacks context about what dynamic text should be added. Consider providing more specific details about the intended functionality.

Suggested change
<!-- TODO: Add dynamic text -->
<!-- TODO: Show ticket status or additional dynamic info here -->

Copilot uses AI. Check for mistakes.
export const consumeConsumable = async (
prisma: PrismaClient,
consumableId: string,
): Promise<Message> => {
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Message type is not imported or defined in this file. This will cause a TypeScript compilation error.

Copilot uses AI. Check for mistakes.
import Price from "$lib/components/Price.svelte";
import type { InventoryItemLoadData } from "$lib/server/shop/inventory/getInventory";
import type { page } from "$app/stores";
import { page } from "$app/stores";
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The page import is added but doesn't appear to be used in the visible code changes. Consider removing unused imports unless they're used elsewhere in the file.

Suggested change
import { page } from "$app/stores";

Copilot uses AI. Check for mistakes.
@ekvanox ekvanox mentioned this pull request Oct 6, 2025
@Isak-Kallini Isak-Kallini linked an issue Oct 6, 2025 that may be closed by this pull request
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ekvanox ekvanox enabled auto-merge (squash) October 6, 2025 20:26
@ManneG ManneG moved this from 🆕 New to 📝In review in CPU Oct 13, 2025
@ManneG ManneG moved this from 📝In review to 🆕 New in CPU Oct 13, 2025
Copy link
Contributor

@fgren fgren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional feedback:

  • Camera issues in Firefox
  • Unhandled error on bad QR codes

@ekvanox ekvanox requested a review from fgren December 1, 2025 19:54
@github-actions
Copy link

github-actions bot commented Jan 2, 2026

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale Has not been updated for 30 days label Jan 2, 2026
Copy link
Contributor

@fgren fgren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Have tested again and errors are handled correctly. The QR scanning works in Chrome, but not in Firefox. (but I think it can be merged anyway?)

@ekvanox
Copy link
Member Author

ekvanox commented Jan 15, 2026 via email

@github-actions github-actions bot removed the stale Has not been updated for 30 days label Jan 16, 2026
@ekvanox ekvanox merged commit 22634df into main Jan 22, 2026
4 checks passed
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in CPU Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

QR scan page

4 participants